package com.icrazy.platform.service.impl;

import java.util.List;

import com.icrazy.platform.common.page.Page;
import com.icrazy.platform.dao.PlatformDao;
import com.icrazy.platform.exception.Ecode;
import com.icrazy.platform.exception.ServiceException;
import com.icrazy.platform.service.PlatformService;
import com.icrazy.platform.util.Ts;

@SuppressWarnings("rawtypes")
public class PlatformServiceImpl implements PlatformService {

	protected PlatformDao dao;

	public PlatformDao getDao() {
		return dao;
	}

	public void setDao(PlatformDao dao) {
		this.dao = dao;
	}

	@Override
	public void insert(String id, Object obj) {
		dao.insert(id, obj);
	}

	@Override
	public void update(String id, Object obj) {
		dao.update(id, obj);
	}

	@Override
	public void delete(String id, Object obj) {
		dao.delete(id, obj);
	}

	@Override
	public Object queryForObject(String id, Object obj) {
		return dao.queryForObject(id, obj);
	}

	@Override
	public List queryForList(String id, Object obj) {
		List rs = dao.queryForList(id, obj);
		if (Ts.hv(rs)) {
			throw new ServiceException(Ecode.VO_LOGIN, "PlatformServiceImpl.queryForList()");
		}
		return rs;
	}

	@Override
	public List queryForPage(String id, Object obj, Page page) {
		return dao.queryForPage(id, obj, page);
	}
}
